<template>
    <svg aria-hidden="true" class="svg-icon">
        <use :href="symbolId" :fill="color"/>
    </svg>
</template>

<script setup lang="ts">
    import {defineProps, computed, withDefaults} from 'vue';

    interface Props {
        prefix?: string;
        name: string;
        color?: string;
    }

    const props = withDefaults(defineProps<Props>(), {
        prefix: 'icon',
    });

    const symbolId = computed(() => `#${props.prefix}-${props.name}`);
</script>

<style scoped>
    .svg-icon {
        width: 1em;
        height: 1em;
        vertical-align: -0.15em;
        fill: currentColor;
        overflow: hidden;
    }
</style>
